A Delta algorithm is one of lossless data compression technologies, and is used to compute Delta encoding between a new file and a reference file that has been stored in a system. For example, when a new file needs to be stored, the new file is separately matched with multiple reference files that have been stored in the system. If similarity between the new file and one of the multiple reference files exceeds a preset threshold, Delta encoding corresponding to the new file is computed, only the Delta encoding needs to be stored in the system, and the new file does not need to be stored. The new file may be restored according to the reference file that is similar to the new file and the Delta encoding corresponding to the new file. In this way, during storage of a similar file, the file is compressed by using Delta encoding, so that storage space can be greatly reduced.
Currently, XDelta encoding is a commonly-used Delta encoding algorithm. A core idea of the XDelta encoding is to search a reference block for a sub-block that matches a target block. For example, generally, if three or four consecutive bytes are the same, it is considered that matching succeeds.
However, in XDelta encoding, matching is performed byte by byte. A larger data amount of a reference block leads to heavier workload in a matching process and a longer time that is consumed. Consequently, data compression efficiency is relatively low.